package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("node.txt",true );
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw =  new PrintWriter(bw,true);
        Scanner sc= new Scanner(System.in);
        System.out.println("请开始输入内容，为exit时退出");
        while (true){
            String str =sc.nextLine();
            if(str.equalsIgnoreCase("exit")){
                break;
            }
            pw.println(str);//写入字符串
        }
        System.out.println("再见！");
        pw.close(); //
    }
}
